// @ts-nocheck
import LogUtil from '../../common/baseUtil/LogUtil.js';
import batteryInfo from '@ohos.batteryInfo';
import Battery from '@system.battery';

let logUtil = new LogUtil();

export default class BatteryModel {
    setOnBatteryPage(callback){
        callback(batteryInfo);
    }

    getStatus(success) {
        try {
            Battery.getStatus({
                success: (data) => {
                    success(data)
                }, fail: (data, code) => {
                    logUtil.info('batteryPage getStatus is fail, data: ' + data + ", code: " + code);
                }
            })
        } catch (e) {
            logUtil.error('batteryPage getStatus is catch: ' + e);
        }
    }
}